Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename to test_mysql_no_override_global_sql_mode #7408

Merged
merged 1 commit into from
Aug 21, 2012

Conversation

yahonda
Copy link
Member

@yahonda yahonda commented Aug 21, 2012

This pull request addresses two failures tested with MySQL 5.6.6 m9 (milestone 9).

$ mysql --version
mysql  Ver 14.14 Distrib 5.6.6-m9, for Linux (x86_64) using  EditLine wrapper
  • Failure with mysql adapter
$ rake test_mysql

... snip ...
Finished tests in 199.465809s, 17.8427 tests/s, 52.2947 assertions/s.

  1) Failure:
test_mysql_strict_mode_disabled(MysqlConnectionTest) [/home/yahonda/git/rails/activerecord/test/cases/adapters/mysql/connection_test.rb:135]:
Expected: [[""]]
  Actual: [["NO_ENGINE_SUBSTITUTION"]]

3559 tests, 10431 assertions, 1 failures, 0 errors, 6 skips
rake aborted!
Command failed with status (1): [/home/yahonda/.rvm/rubies/ruby-1.9.3-p194/...]

Tasks: TOP => test_mysql
(See full trace by running task with --trace)
$ 
  • Failure with mysql2 adapter
$ rake test_mysql2

... snip ...
Finished tests in 166.461722s, 21.3683 tests/s, 62.6330 assertions/s.

1) Failure:
test_mysql_strict_mode_disabled(MysqlConnectionTest) [/home/yahonda/git/rails/activerecord/test/cases/adapters/mysql2/connection_test.rb:51]:
Expected: [[""]]
Actual: [["NO_ENGINE_SUBSTITUTION"]]

3557 tests, 10426 assertions, 1 failures, 0 errors, 18 skips
rake aborted!
Command failed with status (1): [/home/yahonda/.rvm/rubies/ruby-1.9.3-p194/...]

Tasks: TOP => test_mysql2
(See full trace by running task with --trace)
$
  • sql_mode default value as of MySQL 5.6.6 m9.

It might have caused sql_mode default value as of MySQL 5.6.6 m9 is NO_ENGINE_SUBSTITUTION, which was empty at older versions.

mysql> select @@global.sql_mode;
+------------------------+
| @@global.sql_mode      |
+------------------------+
| NO_ENGINE_SUBSTITUTION |
+------------------------+
1 row in set (0.00 sec)

mysql> select @@session.sql_mode;
+------------------------+
| @@session.sql_mode     |
+------------------------+
| NO_ENGINE_SUBSTITUTION |
+------------------------+
1 row in set (0.00 sec)

mysql> quit

This default parameter change is out of control from Rails, then these test verify Rails not overriding the default @@GLOBAL.sql_mode value by checking if @@GLOBAL.sql_mode is the same as @@SESSION.sql_mode.

@@ -44,11 +44,12 @@ def test_mysql_default_in_strict_mode
assert_equal [["STRICT_ALL_TABLES"]], result.rows
end

def test_mysql_strict_mode_disabled
def test_mysql_no_override_global_sql_mode

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps the test names could still have the strict_mode_disabled in them? Seems like it's what's being under test, not? How about:

test_mysql_strict_mode_disabled_dont_override_global_sql_mode

Or something like that?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment.
I was thinking what is the proper test name if MySQL default sql_mode would be changed to STRICT_ALL_TABLES. but it may be too much worrying about future.

I like your idea. test_mysql_strict_mode_disabled_dont_override_global_sql_mode shows its purpose correctly. I'll update my commit.

Reason since MySQL 5.6.6-m9 the `sql_mode` default value is
`NO_ENGINE_SUBSTITUTION`.
This default parameter change is out of control from Rails.

This test verifies Rails not overriding the default `@@GLOBAL.sql_mode` value
by checking if `@@GLOBAL.sql_mode` is the same as `@@SESSION.sql_mode`.
carlosantoniodasilva added a commit that referenced this pull request Aug 21, 2012
Change mysql tests for strict mode disabled to work with new sql_mode default in MySQL 5.6.6-m9.

Since this MySQL version, the sql_mode default value is `NO_ENGINE_SUBSTITUTION`.
@carlosantoniodasilva carlosantoniodasilva merged commit 8c600e4 into rails:master Aug 21, 2012
@carlosantoniodasilva
Copy link
Member

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants